/**
 * 自定义节点类型路由
 * 配置自定义节点类型相关的API端点
 */
const express = require('express')
const router = express.Router()
const customNodeTypeController = require('../controllers/customNodeTypeController')

// 获取所有自定义节点类型
router.get('/custom-node-types', customNodeTypeController.getAllCustomNodeTypes)

// 创建新的自定义节点类型
router.post('/custom-node-types', customNodeTypeController.createCustomNodeType)

// 获取所有已发布的自定义节点类型版本
router.get('/custom-node-types/published', customNodeTypeController.getPublishedVersions)

// 获取单个自定义节点类型
router.get('/custom-node-types/:id', customNodeTypeController.getCustomNodeTypeById)

// 更新自定义节点类型
router.put('/custom-node-types/:id', customNodeTypeController.updateCustomNodeType)

// 删除自定义节点类型
router.delete('/custom-node-types/:id', customNodeTypeController.deleteCustomNodeType)

// 获取自定义节点类型的所有版本
router.get('/custom-node-types/:id/versions', customNodeTypeController.getVersionsByNodeTypeId)

// 创建自定义节点类型的新版本
router.post('/custom-node-types/:id/versions', customNodeTypeController.createVersion)

// 发布自定义节点类型的版本
router.post('/custom-node-types/:id/versions/:versionId/publish', customNodeTypeController.publishVersion)

// 获取自定义节点类型被哪些事件使用
router.get('/custom-node-types/:id/usage', customNodeTypeController.getCustomNodeTypeUsage)

// 获取引用特定版本的事件
router.get('/custom-node-types/versions/:versionId/events', customNodeTypeController.getVersionEvents)

module.exports = router 